home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Text⁄Files / Tape Stuff / Pascal Strings / Pstrcspn.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-24  |  608 b   |  33 lines  |  [TEXT/KAHL]

  1. /****************************************************************************
  2.  *
  3.  * FILE:    Pstrcspn.c
  4.  * CREA:    Sven Axelsson, GU
  5.  * MODF:    fredag 13 april 1990 @ 12.51.48
  6.  * HIST:    90-04-13 (1.0)    First version.
  7.  *
  8.  ****************************************************************************/
  9.  
  10. # include    "pstring.h"
  11.  
  12.  
  13. short 
  14. Pstrcspn(
  15.     register Str255            s1,
  16.     register Str255            s2 )
  17. {
  18.     register unsigned int    i,
  19.                             j;
  20.     unsigned int            l1 = s1[0],            
  21.                             l2 = s2[0];
  22.     
  23.     for( i = 1; i <= l1; i++ ) {
  24.         for( j = 1; j <= l2; j++ ) {
  25.             if( s1[i] == s2[j] ) {
  26.                 goto exit;
  27.             }
  28.         }
  29.     }
  30.  
  31. exit:    
  32.     return( --i );
  33. }